# Since I entered the class late, I will try my best to submit the assignments on time. 

# The first method
a = 0
b = 1
index = 0
print('fib({}) = {}'.format(index ,a))
index += 1
print('fib({}) = {}'.format(index ,b))

while True:
    c = a + b
    index += 1
    if c > 100:
        break

    print('fib({}) = {}'.format(index ,c))
    
    a = b
    b = c



# The second method
list_fib = []

a = 0
list_fib.append(a)

b = 1
list_fib.append(b)

while True:
    c = a + b
    
    if c > 100:
        break
        
    list_fib.append(c)

    a = b
    b = c

list_fib

# 斐波那契数列是从1开始的，不是从0开始。你这里上下两种方法是一样的。
# 老师好，以下是修改过后的代码。

# The first method
a = 1
b = 1
index = 0
print('fib({}) = {}'.format(index ,a))
index += 1
print('fib({}) = {}'.format(index ,b))

while True:
    c = a + b
    index += 1
    if c > 100:
        break

    print('fib({}) = {}'.format(index ,c))

    a = b
    b = c


# The second method
def fib(n, a=0, b=1):
    a, b = b, a+b
    if n == 1:
        return a
    return fib(n-1, a, b) 

n = 1

while True:
    if fib(n) < 100:
        print('fib({}) = {}'.format(n ,fib(n)))
        n += 1
    else:
        break

